﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

public partial class ViewByFirstName : System.Web.UI.Page
{
    dbConn db = new dbConn();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["FirstName"].ToString() != null)
        {
            firstDataBind();
        }
      
    }

    

    private void firstDataBind()
    {
        string fname;
        fname = Request.QueryString["FirstName"].ToString();
        fv.DataSource = db.ViewsByFirst(fname);
        fv.DataBind();
    }






    protected void fv_DataBound(object sender, ListViewItemEventArgs e)
    {
        Label lblPYN;

        //if ( bool.Parse(Eval("LicenseYN")).ToString()  == true)

        //    lblPYN.Text = "Yes";
        //else
        //    lblPYN.Text = "Yes";



        if (e.Item.ItemType == ListViewItemType.DataItem)
        {
            lblPYN = (Label)e.Item.FindControl("lblPYN");
            lblPYN.ForeColor = Color.Blue;
            bool linkable = (bool)DataBinder.Eval(e.Item.ItemType, "isLinkable");
            if (linkable)
                lblPYN.Text = "Yes";
            else
                lblPYN.Text = "No";
           // System.Data.DataRowView rowView = e.Item.DataItem as System.Data.DataRowView;
            

        }
    }

    protected void fv_DataBound1(object sender, EventArgs e)
    {
        FormViewRow row = fv.Row;
        Label lblPYN, LicenseYN, lblFallYN, lblSpringYN, lblsummerYN;
        lblPYN = (Label)row.FindControl("lblPYN");
        if (lblPYN.Text == "True")
        {
            lblPYN.ForeColor = Color.Blue;
            lblPYN.Text = "Yes";

        }
        else
        {
            lblPYN.ForeColor = Color.Blue;
            lblPYN.Text = "No";

        }


        LicenseYN = (Label)row.FindControl("LicenseYN");

        if (LicenseYN.Text == "True" )
            {
                LicenseYN.ForeColor = Color.Blue;
                LicenseYN.Text = "Yes";

            }
            else
            {
                LicenseYN.ForeColor = Color.Blue;
                LicenseYN.Text = "No";

            }

        lblFallYN = (Label)row.FindControl("lblFallYN");

        if (lblFallYN.Text == "True")
        {
            lblFallYN.ForeColor = Color.Blue;
            lblFallYN.Text = "Yes";

        }
        else
        {
            lblFallYN.ForeColor = Color.Blue;
            lblFallYN.Text = "No";

        }
        lblSpringYN = (Label)row.FindControl("lblSpringYN");

        if (lblSpringYN.Text == "True")
        {
            lblSpringYN.ForeColor = Color.Blue;
            lblSpringYN.Text = "Yes";

        }
        else
        {
            lblSpringYN.ForeColor = Color.Blue;
            lblSpringYN.Text = "No";

        }
        lblsummerYN = (Label)row.FindControl("lblsummerYN");

        if (lblsummerYN.Text == "True")
        {
            lblsummerYN.ForeColor = Color.Blue;
            lblsummerYN.Text = "Yes";

        }
        else
        {
            lblsummerYN.ForeColor = Color.Blue;
            lblsummerYN.Text = "No";

        }


    }
   
}
